]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Use ClutterPanGesture for touchscreen scrolling
authorJonas Dreßler <verdre@v0yd.nl>
Fri, 8 Apr 2022 23:21:54 +0000 (01:21 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 28 Aug 2025 17:14:06 +0000 (19:14 +0200)
ClutterPanGesture replaced ClutterPanAction and uses Clutters new
gesture tracker, let's switch to the shiny new thing.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2853>

js/ui/search.js

index 44db1ac75c1767f5a79118c1da8a75761fc19025..8ac92888a69cdbd080ff4af41902669561e87b0b 100644 (file)
@@ -582,9 +582,9 @@ export const SearchResultsView = GObject.registerClass({
             child: this._content,
         });
 
-        let action = new Clutter.PanAction({interpolate: true});
-        action.connect('pan', this._onPan.bind(this));
-        this._scrollView.add_action(action);
+        const panGesture = new Clutter.PanGesture();
+        panGesture.connect('pan-update', this._onPanUpdate.bind(this));
+        this._scrollView.add_action(panGesture);
 
         this.add_child(this._scrollView);
 
@@ -761,11 +761,11 @@ export const SearchResultsView = GObject.registerClass({
         this.emit('terms-changed');
     }
 
-    _onPan(action) {
-        let [dist_, dx_, dy] = action.get_motion_delta(0);
-        let adjustment = this._scrollView.vadjustment;
-        adjustment.value -= (dy / this.height) * adjustment.page_size;
-        return false;
+    _onPanUpdate(gesture) {
+        const adjustment = this._scrollView.vadjustment;
+        const delta = gesture.get_delta();
+
+        adjustment.value -= (delta.get_y() / this.height) * adjustment.page_size;
     }
 
     _focusChildChanged(provider) {